package pr.vodafone.dao.ws;

import java.sql.SQLException;
import java.util.Vector;

import pr.vodafone.dao.*;
import pr.vodafone.dao.dto.Terminal;

public class TerminalesSW {

	private GestorBD gestor = new GestorBD();

	public Terminal obtenerTerminal(String idTerminal)
			throws ClassNotFoundException, SQLException {
		Terminal terminal = null;
		gestor.conectar();

		terminal = gestor.obtenerTerminal(idTerminal);

		gestor.desconectar();

		return terminal;

	}

	public Vector<Terminal> obtenerTerminal() throws ClassNotFoundException,
			SQLException {
		Vector<Terminal> terminales = new Vector<Terminal>();
		gestor.conectar();

		terminales = gestor.obtenerTerminales();

		gestor.desconectar();

		return terminales;

	}

	public Vector<Terminal> obtenerTerminalesPorMarca(String marca)
			throws ClassNotFoundException, SQLException {
		Vector<Terminal> terminales = new Vector<Terminal>();
		gestor.conectar();

		terminales = gestor.obtenerTerminalesPorMarca(marca);

		gestor.desconectar();

		return terminales;

	}

	public boolean insertarTerminal(Terminal terminal) throws ClassNotFoundException, SQLException {

		gestor.conectar();

		gestor.insertarTerminal(terminal);

		gestor.desconectar();

		return true;

	}
	
	public boolean actualizarTerminal(String idTerminal, Terminal terminal) throws ClassNotFoundException, SQLException{
		
		gestor.conectar();

		gestor.actualizarTerminal(idTerminal, terminal);

		gestor.desconectar();

		return true;
		
	}
	
public boolean borrarTerminal(String idTerminal) throws ClassNotFoundException, SQLException{
		
		gestor.conectar();

		gestor.borrarTerminal(idTerminal);

		gestor.desconectar();

		return true;
		
	}

}
